package main

import "sync"

func main() {
	l := sync.RWMutex{}
	wg := sync.WaitGroup{}
	j := 1
	for i := 0; i < 10; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			l.Lock()
			defer l.Unlock()
			println(j)
			j++
		}()
	}
	wg.Wait()
}
